<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module swc_node</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module swc_node</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
     An Erlang implementation of a Server Wide Logical Clock,
     in this case a Bitmapped Version Vector.

<p><b>Authors:</b> Ricardo Gonçalves (<a href="mailto:tome.wave@gmail.com"><tt>tome.wave@gmail.com</tt></a>).</p>

<h2><a name="description">Description</a></h2>
     An Erlang implementation of a Server Wide Logical Clock,
     in this case a Bitmapped Version Vector.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add-2">add/2</a></td><td>Adds a dot (ID, Counter) to a BVV.</td></tr>
<tr><td valign="top"><a href="#base-1">base/1</a></td><td>Takes and returns a BVV where in each entry, the bitmap is reset to zero.</td></tr>
<tr><td valign="top"><a href="#event-2">event/2</a></td><td>Takes a BVV at node Id and returns a pair with sequence number for a new
  event (dot) at node Id and the original BVV with the new dot added; this
  function makes use of the invariant that the node BVV for node Id knows all
  events generated at Id, i.e., the first component of the pair denotes the
  last event, and the second component, the bitmap, is always zero.</td></tr>
<tr><td valign="top"><a href="#get-2">get/2</a></td><td>Returns the entry of a BVV associated with a given ID.</td></tr>
<tr><td valign="top"><a href="#ids-1">ids/1</a></td><td>Returns all IDs from the entries in a BVV.</td></tr>
<tr><td valign="top"><a href="#join-2">join/2</a></td><td>Joins entries from BVV2 that are also IDs in BVV1, into BVV1.</td></tr>
<tr><td valign="top"><a href="#merge-2">merge/2</a></td><td>Merges all entries from the two BVVs.</td></tr>
<tr><td valign="top"><a href="#new-0">new/0</a></td><td>Constructs an empty BVV (an orddict in Erlang).</td></tr>
<tr><td valign="top"><a href="#norm-1">norm/1</a></td><td>Normalizes an entry pair, by removing dots and adding them to the base
  if they are contiguous with the base.</td></tr>
<tr><td valign="top"><a href="#store_entry-3">store_entry/3</a></td><td>Stores an Id-Entry pair in a BVV; if the id already exists, the
  associated entry is replaced by the new one.</td></tr>
<tr><td valign="top"><a href="#values-1">values/1</a></td><td>Returns the sequence numbers for the dots represented by an entry.</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="add-2">add/2</a></h3>
<div class="spec">
<p><tt>add(BVV::<a href="#type-bvv">bvv()</a>, X2::{<a href="#type-id">id()</a>, <a href="#type-counter">counter()</a>}) -&gt; <a href="#type-bvv">bvv()</a></tt><br></p>
</div><p>Adds a dot (ID, Counter) to a BVV.</p>

<h3 class="function"><a name="base-1">base/1</a></h3>
<div class="spec">
<p><tt>base(BVV::<a href="#type-bvv">bvv()</a>) -&gt; <a href="#type-bvv">bvv()</a></tt><br></p>
</div><p>Takes and returns a BVV where in each entry, the bitmap is reset to zero.</p>

<h3 class="function"><a name="event-2">event/2</a></h3>
<div class="spec">
<p><tt>event(BVV::<a href="#type-bvv">bvv()</a>, Id::<a href="#type-id">id()</a>) -&gt; {<a href="#type-counter">counter()</a>, <a href="#type-bvv">bvv()</a>}</tt><br></p>
</div><p>Takes a BVV at node Id and returns a pair with sequence number for a new
  event (dot) at node Id and the original BVV with the new dot added; this
  function makes use of the invariant that the node BVV for node Id knows all
  events generated at Id, i.e., the first component of the pair denotes the
  last event, and the second component, the bitmap, is always zero.</p>

<h3 class="function"><a name="get-2">get/2</a></h3>
<div class="spec">
<p><tt>get(K::<a href="#type-id">id()</a>, B::<a href="#type-bvv">bvv()</a>) -&gt; <a href="#type-entry">entry()</a></tt><br></p>
</div><p>Returns the entry of a BVV associated with a given ID.</p>

<h3 class="function"><a name="ids-1">ids/1</a></h3>
<div class="spec">
<p><tt>ids(B::<a href="#type-bvv">bvv()</a>) -&gt; [<a href="#type-id">id()</a>]</tt><br></p>
</div><p>Returns all IDs from the entries in a BVV.</p>

<h3 class="function"><a name="join-2">join/2</a></h3>
<div class="spec">
<p><tt>join(BVV1::<a href="#type-bvv">bvv()</a>, BVV2::<a href="#type-bvv">bvv()</a>) -&gt; <a href="#type-bvv">bvv()</a></tt><br></p>
</div><p>Joins entries from BVV2 that are also IDs in BVV1, into BVV1.</p>

<h3 class="function"><a name="merge-2">merge/2</a></h3>
<div class="spec">
<p><tt>merge(BVV1::<a href="#type-bvv">bvv()</a>, BVV2::<a href="#type-bvv">bvv()</a>) -&gt; <a href="#type-bvv">bvv()</a></tt><br></p>
</div><p>Merges all entries from the two BVVs.</p>

<h3 class="function"><a name="new-0">new/0</a></h3>
<div class="spec">
<p><tt>new() -&gt; <a href="#type-bvv">bvv()</a></tt><br></p>
</div><p>Constructs an empty BVV (an orddict in Erlang).</p>

<h3 class="function"><a name="norm-1">norm/1</a></h3>
<div class="spec">
<p><tt>norm(X1::<a href="#type-entry">entry()</a>) -&gt; <a href="#type-entry">entry()</a></tt><br></p>
</div><p>Normalizes an entry pair, by removing dots and adding them to the base
  if they are contiguous with the base.</p>

<h3 class="function"><a name="store_entry-3">store_entry/3</a></h3>
<div class="spec">
<p><tt>store_entry(Id, Entry, BVV) -&gt; any()</tt></p>
</div><p>Stores an Id-Entry pair in a BVV; if the id already exists, the
  associated entry is replaced by the new one.</p>

<h3 class="function"><a name="values-1">values/1</a></h3>
<div class="spec">
<p><tt>values(X1::<a href="#type-entry">entry()</a>) -&gt; [<a href="#type-counter">counter()</a>]</tt><br></p>
</div><p>Returns the sequence numbers for the dots represented by an entry.</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Oct 29 2015, 16:20:19.</i></p>
</body>
</html>
